const fs = require("fs");

const list = [
    { name: '张1', gender: "女" },
    { name: '张2', gender: "男" },
    { name: '张3', gender: "女" },
    { name: '张4', gender: "男" },
    { name: '张5', gender: "女" },
    { name: '张6', gender: "男" },
]

let list3 = [], list2 = []

list2 = list.filter(item => item.gender === "男");
list3 = list.filter(item => item.gender === "女");


fs.writeFileSync("./data/2.txt", `${JSON.stringify(list2)}`)
fs.writeFileSync("./data/3.txt", `${JSON.stringify(list3)}`)
